<%--
  Created by IntelliJ IDEA.
  User: Samoji
  Date: 4/26/13
  Time: 5:12 PM
  To change this template use File | Settings | File Templates.
--%>
<%@ page import="org.codehaus.groovy.grails.web.servlet.GrailsApplicationAttributes" %>
<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title><g:layoutTitle default="${meta(name: 'app.name')}"/></title>
    <meta name="description" content="">
    <meta name="author" content="Charles Balachandran, Nathan Koefer, Alessio Scannapieco">

    <meta name="viewport" content="initial-scale = 1.0">

    <!-- Le HTML5 shim, for IE6-8 support of HTML elements -->
    <!--[if lt IE 9]>
			<script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
		<![endif]-->

    <!--r:require modules="scaffolding"/-->

    <!-- Le fav and touch icons -->
    <link rel="shortcut icon" href="${resource(dir: 'images', file: 'favicon.ico')}" type="image/x-icon">
    <link rel="apple-touch-icon" href="${resource(dir: 'images', file: 'apple-touch-icon.png')}">
    <link rel="apple-touch-icon" sizes="72x72" href="${resource(dir: 'images', file: 'apple-touch-icon.png')}">
    <link rel="apple-touch-icon" sizes="114x114" href="${resource(dir: 'images', file: 'apple-touch-icon-retina.png')}">
    <r:require modules="bootstrap" />
    <r:require module="jquery" />
    <g:javascript src="application.js" />
    <g:layoutHead/>
    <r:layoutResources/>
    <style type="text/css">
    body {
        padding: 60px;
    }
    </style>

    <g:javascript>
//        $('#modal-login').click(function(){
//            alert("MIAP")
//            $('#inputUsername').focus();
//        });
    </g:javascript>

    <jq:jquery>
        loadAll();
    </jq:jquery>
</head>

<body>

<div class="navbar navbar-inverse navbar-fixed-top">
    <div class="navbar-inner">
        <div class="container-fluid">
            <button type="button" class="btn btn-navbar" data-toggle="collapse" data-target=".nav-collapse">
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="brand" href="${createLink(controller: 'index', action: 'index')}">Board On Grails</a>
            <div class="nav-collapse collapse">
                <p class="navbar-text pull-right">
                    <g:loginToggle/>
                    <g:if test="${!session.user}">
                        <a href="${createLink(controller: 'user', action: 'create')}" class="navbar-link">Register</a>
                    </g:if>
                </p>
                <ul class="nav">
                    %{--<li class="active"><a href="${createLink(controller: 'index')}">Home</a></li>--}%
                    %{--<li><a href="#about">About</a></li>--}%
                    %{--<li><a href="#contact">Contact</a></li>--}%
                </ul>
            </div><!--/.nav-collapse -->
        </div>
    </div>
</div>

<div class="container-fluid">
    <div class="row-fluid">
        <div class="span2">
            <div class="well sidebar-nav">
                <ul class="nav nav-list">
                    %{--<li class="nav-header">Profilo</li>--}%

                    <!-- Modal login -->
                    <div id="modal-login" class="modal hide fade" tabindex="0" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
                        <div class="modal-header">
                            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
                            <h3 id="myModalLabel">Login</h3>
                        </div>
                    <div class="modal-body">
                        <g:form class="modal-body" controller="user" action="doLogin" method="post">

                            <input type="hidden" name="cName" value="${cName}">
                            <input type="hidden" name="aName" value="${aName}">

                            <div class="control-group">
                                <label class="control-label" for="inputUsername">Username</label>
                                <div class="controls">
                                    <input type="text" id="inputUsername" placeholder="Username" name="username">
                                </div>
                            </div>
                            <div class="control-group">
                                <label class="control-label" for="inputPassword">Password</label>
                                <div class="controls">
                                    <input type="password" id="inputPassword" placeholder="Password" name="password">
                                </div>
                            </div>

                            </div>


                            <div class="errors">
                                <p> ${flash.message}</p>
                            </div>

                            <div class="modal-footer">
                                <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button>
                                <g:submitButton name="Sign in" class="btn btn-primary">Sign in</g:submitButton>

                            </div>
                        </g:form>
                    </div>


                    %{--<li class="link"><a href="<g:createLink controller="User" action="list" />">Users</a></li>--}%

                    <li class="nav-header">Threads</li>
                    <li class="link"><a href="<g:createLink controller="Thread" action="create" />">Create thread</a></li>

                    <li class="nav-header">Courses</li>
                    <li class="link"><a href="<g:createLink controller="Course" action="list" />">Show courses</a></li>

                    <g:if test="${session.user?.type == 'Admin'}">
                        <li class="nav-header">Users</li>
                        <li class="link"><a href="<g:createLink controller="user" action="list" />">Show users</a></li>

                        <li class="nav-header">Course</li>
                        <li class="link"><a href="<g:createLink controller="course" action="create" />">Create course</a></li>

                        <li class="nav-header">Tags</li>
                        <li class="link"><a href="<g:createLink controller="tag" action="create" />">Create tag</a></li>
                    </g:if>


                </ul>
            </div>
        </div>

        <div class="span10">
            <g:layoutBody/>
        </div>
    </div>

    <hr>
    <footer>

        <p>&copy; SUPSI 2013</p>
    </footer>
</div>

<r:layoutResources/>

</body>
</html>